<template>
	<page-meta><navigation-bar title="客服中心" front-color="#000000" background-color="#ffffff" /></page-meta>
	<view style="text-align: center;">
		<image src="/static/img/QQ.svg" style="width: 70px;height: 55px;display: block;margin: 0 auto;margin-top: 60rpx;" mode=""></image>
		<text style="display: inline-block;padding-top: 20rpx;font-size: 16px;">点击拨打24小时服务热线</text>
		<text style="display: block;font-weight: bold;margin-top: 5px;">{{obj.kfphone}}</text>
		<button @tap="boda(obj.kfphone)" type="default" style="background: #168cec;color: #fff;font-size: 14px;line-height: 26px;width: auto;display: inline-block;margin-top: 20rpx;">拨打电话</button>
		<image src="/static/img/QQ1.svg" style="width: 70px;height: 55px;display: block;margin: 0 auto;margin-top: 60rpx;" mode=""></image>
		<text style="display: inline-block;padding-top: 20rpx;font-size: 16px;">点击用QQ联系概率社区客服</text>
		<text style="display: block;font-weight: bold;margin-top: 5px;">{{obj.kfqq}}</text>
		<button @tap="tiqi(obj.kfqq)" type="default" style="background: #168cec;color: #fff;font-size: 14px;line-height: 26px;width: auto;display: inline-block;margin-top: 20rpx;">调起QQ</button>
		<image src="/static/img/QQ2.svg" style="width: 70px;height: 55px;display: block;margin: 0 auto;margin-top: 60rpx;" mode=""></image>
		<text style="display: inline-block;padding-top: 20rpx;font-size: 16px;">点击复制微信号 联系微信客服</text>
		<text style="display: block;font-weight: bold;margin-top: 5px;">{{obj.kfwx}}</text>
		<button @tap="fuzhi(obj.kfwx)" type="default" style="background: #168cec;color: #fff;font-size: 14px;line-height: 26px;width: auto;display: inline-block;margin-top: 20rpx;">复制微信	</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				obj:{}
			}
		},
		methods: {
			getdata(){
				var _this = this;
				uni.request({
					url: _this.$store.state.url + '/api/shequuser/mycenter/onlineservice',
					method: 'POST',
					success: res => {
						res = res.data;
						if (res.code == 200) {
							// console.log(res)
							_this.obj = res.data;
						} else {
						}
					},
					fail: res => {
						console.log(res);
					}
				});
			},
			boda(num){
				uni.makePhoneCall({
				    phoneNumber: num //仅为示例
				});
			},
			tiqi(q){
				plus.runtime.openURL('mqq://im/chat?chat_type=wpa&uin=' +q+ '&version=1&src_type=web ',function (res) {
					plus.nativeUI.alert("本机没有安装QQ，无法启动");
				});
			},
			fuzhi(text){
				uni.setClipboardData({
				    data: text,
				    success: function () {
				        uni.showToast({
				        	title: '已复制微信号！',
				        	icon: 'none',
				        	duration: 2000
				        	// position:'top'
				        });
				    }
				});
			}
		},
		onShow() {
			var _this = this;
			uni.getNetworkType({
				success: function(res) {
					if (res.networkType == 'none') {
						uni.showToast({
							title: '当前无网络连接，请检查！',
							icon: 'none',
							duration: 5000
			
							// position:'top'
						});
					}
				}
			});
			uni.onNetworkStatusChange(function(res) {
				if (!res.isConnected) {
					uni.showToast({
						title: '当前无网络连接，请检查！',
						icon: 'none',
						duration: 3000
						// position:'top'
					});
				} else {
					uni.showToast({
						title: '网络已连接！',
						icon: 'none',
						duration: 3000
						// position:'top'
					});
					_this.getdata();
				}
			});
			_this.getdata();
		}
	}
</script>

<style>

</style>
